package net.j4love.spring.boot.webmvc;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author He Peng
 * @create 2017-05-19 15:52
 * @update 2017-05-19 15:52
 * @see
 */

@RequestMapping("/webmvc")
@RestController
public class Controller {

    @RequestMapping(value = "/hello" , method = RequestMethod.GET)
    public Map<String,Object> hello() {

        Map<String,Object> person = new HashMap<>();
        person.put("姓名","李明");
        person.put("职业","小学生");
        person.put("年龄",12);
        person.put("最喜欢的课程","英语");
        person.put("想要去的国家","米国");
        person.put("信息更新时间",new Date());
        return person;
    }


    @RequestMapping(value = "/ex" , method = RequestMethod.GET)
    public void ex() {

        throw new RuntimeException("李华和小明是好朋友他们一起在英语书中出现了多年.~~!其实这是一个异常来着");
    }
}
